package com.chanyachting.emall.action.companyproduct;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.chanyachting.emall.domain.Sellyacht;
import com.chanyachting.emall.form.SellyachtForm;
import com.chanyachting.emall.service.CompanyproductService;
import com.chanyachting.emall.serviceImpl.CompanyproductServiceImpl;
import com.chanyachting.emall.util.DateUtil;


//创建游艇销售
public class CreateSellyachtAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		SellyachtForm syform=(SellyachtForm)form;
		
		try {
			
			Sellyacht sy=new Sellyacht();
			
			
			BeanUtils.copyProperties(sy, syform);
			
			sy.setCreateDate(DateUtil.getDate());  //设置创建时间
			sy.setTitle(sy.getName());
			
			CompanyproductService cpservice=new CompanyproductServiceImpl();
			
			cpservice.createCompanyproduct(sy);  //创建公司产品
			
		} catch (Exception e) {
			
			e.printStackTrace();
		}
		
		
		return mapping.findForward("");
	}
	
	
	

}
